import axios from "axios";

axios.defaults.baseURL = "http://localhost:9000";
if (process.env.NODE_ENV === "production") {
  axios.defaults.baseURL = "http://192.168.199.39:9000";
}
axios.interceptors.response.use((response) => {
  if (response.status === 200) {
    return response.data;
  }
  return response;
});

interface Response {
  code: number;
  data: { age: number; gender: string; name: string }[];
  msg: string;
}

export function getUserList(): Promise<Response> {
  return axios.get<any, Response, any>("/user");
}

export default axios;
/**
scp -i ~/.ssh/build.key -r ./src root@192.168.199.39:/var/www/website

 */
